package android.MediaStreaming;

import java.io.IOException;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;

/**
 * 
 * The main activity of the project. Called when the user selects to run the
 * application from the menu.
 *
 */
public class MediaStreaming extends Activity {
	
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);	//Calls the onCreate method of the parent
        setContentView(R.layout.main);		/*Means that all the widgets (buttons, text fields etc. 
        									  can be found in res/layout/main.xml */

        Button next = (Button) findViewById(R.id.ReceiverButton);	
        //next points to the button named "Button01" in main.xml
        next.setOnClickListener(new View.OnClickListener() {
            public void onClick(View view) {
            	//When clicking the button pointed by next, the activity of FileSystemTests starts
                Intent myIntent = new Intent(view.getContext(), ReceiverActivity.class);
                startActivityForResult(myIntent, 0);
            }

        });
        
        Button senderButton = (Button) findViewById(R.id.SenderButton);	
        //next points to the button named "SenderButton" in main.xml
        senderButton.setOnClickListener(new View.OnClickListener() {
        	public void onClick(View view) {
        		//When clicking the button pointed by next, the activity of FileSystemTests starts
        		Intent myIntent = new Intent(view.getContext(), StreamingTests.class);
        		try {
        		startActivityForResult(myIntent, 0);
        		}
        		catch (Exception e) {
        	    	Log.e(getClass().getName(), "Activity not found", e);            		
            	}
        	}
        });
    }
}